package com.supermap.dataservice.project.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author aqua
 * @description 专家咨询产品
 * @date 2018年11月06 下午 5:08
 * @email 1301584033@qq.com
 */
@Mapper
public interface ExpertAdvMapper {

    @Select("select t3.showName ,t1.question, date_format(t1.uploadTime,'%Y-%m-%d %H:%i:%S') as commentTime,t2.comment from t_advisoryinfo t1 \n" +
            "            inner join t_advinfocomment t2\n" +
            "            on t1.id = t2.advInfoId\n" +
            "            inner join t_user t3\n" +
            "            on t1.userId = t3.id\n" +
            "            inner join \n" +
            "            (select t4.id as id ,t4.userid, t5.showname as showname from t_expertinfo t4\n" +
            "            inner join t_user t5\n" +
            "            on t4.userid = t5.id) as TX \n" +
            "            on TX.userid = t2.userid \n" +
            "            where TX.id = #{expertId}\n" +
            "            order by t1.uploadTime desc;")
    List<Map<String, Object>> getListAdvComment(@Param("expertId") Integer expertid);


    @Select("\tselect t1.productID, t1.title,t1.content,date_format(t1.createTime,'%Y-%m-%d %H:%i:%S') as createTime from t_expertproduct t1 \n" +
            "\twhere t1.expid= #{expertId}\t order by createTime desc;")
    List<Map<String, Object>> getExpert(@Param("expertId") Integer expertid);



}





